import os

import openpyxl
from openpyxl.worksheet.worksheet import Worksheet

class DoExcel():
	#读全部
	data_path = r"D:\pythonProject"
	def readExcelS(self,fname):
		# 读excel文件
		# eFile = os.path.join (data_path, "fname")
		#载入一个工作簿
		workbook = openpyxl.load_workbook (fname)
		#
		#获取要处理的sheet页
		# 变量名：类型：是对变量的注解
		# sheet1:Worksheet=workbook.get_sheet_by_name("Sheet1")
		#获取当前激活的sheet
		sheet1:Worksheet=workbook.active
		# #读sheet中的内容
		print("hjhjhjhj")
		l=[i for i in sheet1.values]

		return l

	#读部分
	def readExcelRowCol(self,fname,stname,minR=None,maxR=None,minC=None,maxC=None):
		# 读excel文件
		# eFile = os.path.join (data_path, "fname")
		# 载入一个工作簿
		workbook = openpyxl.load_workbook (fname)
		#
		# 获取要处理的sheet页
		# 变量名：类型：是对变量的注解
		# sheet1:Worksheet=workbook.get_sheet_by_name("Sheet1")
		# 获取当前激活的sheet
		# sheet1: Worksheet = workbook.active
		sheet1: Worksheet = workbook[stname]
		# #读sheet中的内容
		a=sheet1.iter_rows(min_row=minR,max_row=maxR,min_col=minC,max_col=maxC,values_only=True)

		l = [i for i in a]

		return l

	#写文件
	def writeExcel(self):
		pass
